﻿using System;
using Com.Lancetinc.Evs.Models;
using Com.Lancetinc.Evs.Services;
using Prism.Events;

namespace Com.Lancetinc.Evs.Events
{
    public static class KnownAppEvents
    {
        #region RecordStateChanged

        public static PubSubEvent<RecordStateChangedEventArgs> RecordStateChangedEvent => EventBus.GetPubSubEvent<RecordStateChangedEventArgs>();

        public static void PublishRecordStateChangedEvent(bool recording)
        {
            RecordStateChangedEvent.Publish(new RecordStateChangedEventArgs(recording));
        }

        #endregion

        #region ComboBoxAutoCompleteItemsChanged

        public static PubSubEvent<ComboBoxAutoCompleteItemsChangedEventArgs> ComboBoxAutoCompleteItemsChangedEvent => EventBus.GetPubSubEvent<ComboBoxAutoCompleteItemsChangedEventArgs>();

        public static void PublishComboBoxAutoCompleteItemsChanged(string name, string[] items)
        {
            ComboBoxAutoCompleteItemsChangedEvent.Publish(new ComboBoxAutoCompleteItemsChangedEventArgs(name, items));
        }

        #endregion

        #region 屏幕相关

        #region RequireChangeFullScreenState

        public static PubSubEvent<RequireChangeFullScreenStateEventArgs> RequireChangeFullScreenStateEvent => EventBus.GetPubSubEvent<RequireChangeFullScreenStateEventArgs>();
        /// <summary>
        /// 请求改变全屏状态
        /// </summary>
        public static void PublishRequireChangeFullScreenState(bool isFullScreen)
        {
            RequireChangeFullScreenStateEvent.Publish(new RequireChangeFullScreenStateEventArgs(isFullScreen));
        }
        #endregion

        #endregion

        #region 设备相关

        #region InstrumentErrorStateChanged

        public static PubSubEvent<InstrumentErrorStateChangedEventArgs> InstrumentErrorStateChangedEvent => EventBus.GetPubSubEvent<InstrumentErrorStateChangedEventArgs>();
        /// <summary>
        /// 错误状态改变
        /// </summary>
        public static void PublishInstrumentErrorStateChanged(IInstrumentState state)
        {
            InstrumentErrorStateChangedEvent.Publish(new InstrumentErrorStateChangedEventArgs(state));
        }
        #endregion

        #region InstrumentErrorStateChanged
        public static PubSubEvent<InstrumentLedStateChangedEventArgs> InstrumentLedStateChangedEvent => EventBus.GetPubSubEvent<InstrumentLedStateChangedEventArgs>();
        /// <summary>
        /// LED状态改变
        /// </summary>
        public static void PublishInstrumentLedStateChanged(IInstrumentState state)
        {
            InstrumentLedStateChangedEvent.Publish(new InstrumentLedStateChangedEventArgs(state));
        }
        #endregion

        #endregion

        #region 播放相关

        #region RequireStopVideoRecord

        public static PubSubEvent<RequireStopVideoRecordEventArgs> RequireStopVideoRecordEvent => EventBus.GetPubSubEvent<RequireStopVideoRecordEventArgs>();
        /// <summary>
        /// 请求停止录像
        /// </summary>
        public static void PublishRequireStopVideoRecord(RequireStopReason reason = RequireStopReason.UserStop)
        {
            RequireStopVideoRecordEvent.Publish(new RequireStopVideoRecordEventArgs(reason));
        }
        #endregion

        #region RequireCaptureScreen

        public static PubSubEvent<RequireCaptureScreenEventArgs> RequireCaptureScreenEvent => EventBus.GetPubSubEvent<RequireCaptureScreenEventArgs>();
        /// <summary>
        /// 请求截图
        /// </summary>
        public static void PublishRequireCaptureScreen()
        {
            RequireCaptureScreenEvent.Publish(new RequireCaptureScreenEventArgs());
        }
        #endregion

        #region RequireCaptureScreen

        public static PubSubEvent<CaptureImageChangedEventArgs> CaptureImageChangedEvent => EventBus.GetPubSubEvent<CaptureImageChangedEventArgs>();
        /// <summary>
        /// 截图成功
        /// </summary>
        public static void PublishCaptureImageChanged(ExperInfo experInfo, int reason)
        {
            CaptureImageChangedEvent.Publish(new CaptureImageChangedEventArgs(experInfo, reason));
        }
        #endregion

        #region RequireShowCapturedImage

        public static PubSubEvent<RequireShowCapturedImageEventArgs> RequireShowCapturedImageEvent => EventBus.GetPubSubEvent<RequireShowCapturedImageEventArgs>();
        /// <summary>
        /// 请求显示截图列表
        /// </summary>
        public static void PublishRequireShowCapturedImage(ExperInfo experInfo, string imageName, TimeSpan? showDuration)
        {
            RequireShowCapturedImageEvent.Publish(new RequireShowCapturedImageEventArgs(experInfo, imageName, showDuration));
        }
        #endregion

        #region VideoRecordStartedEvent

        public static PubSubEvent<VideoRecordStartedEventArgs> VideoRecordStartedEvent => EventBus.GetPubSubEvent<VideoRecordStartedEventArgs>();
        /// <summary>
        /// 录像开始
        /// </summary>
        public static void PublishVideoRecordStarted(ExperInfo experInfo)
        {
            VideoRecordStartedEvent.Publish(new VideoRecordStartedEventArgs(experInfo));
        }

        #endregion

        #region VideoRecordStartedEvent

        public static PubSubEvent<VideoRecordPausedEventArgs> VideoRecordPausedEvent => EventBus.GetPubSubEvent<VideoRecordPausedEventArgs>();
        /// <summary>
        /// 录像暂停
        /// </summary>
        public static void PublishVideoRecordPaused(ExperInfo experInfo)
        {
            VideoRecordPausedEvent.Publish(new VideoRecordPausedEventArgs(experInfo));
        }

        #endregion

        #region VideoRecordStoppedEvent

        public static PubSubEvent<VideoRecordStoppedEventArgs> VideoRecordStoppedEvent => EventBus.GetPubSubEvent<VideoRecordStoppedEventArgs>();
        /// <summary>
        /// 录像停止
        /// </summary>
        public static void PublishVideoRecordStopped(ExperInfo experInfo)
        {
            VideoRecordStoppedEvent.Publish(new VideoRecordStoppedEventArgs(experInfo));
        }

        #endregion


        #endregion

        #region 实验相关

        #region RequireSaveCurrentExper
        public static PubSubEvent<RequireSaveCurrentExperEventArgs> RequireSaveCurrentExperEvent => EventBus.GetPubSubEvent<RequireSaveCurrentExperEventArgs>();
        /// <summary>
        /// 请求保存当前实验
        /// </summary>
        public static void PublishRequireSaveCurrentExper(ExperInfo experInfo)
        {
            RequireSaveCurrentExperEvent.Publish(new RequireSaveCurrentExperEventArgs(experInfo));
        }

        #endregion

        #endregion

        #region 报告相关

        #region ReportTemplatePreviewChanged
        public static PubSubEvent<ReportTemplatePreviewChangedEventArgs> ReportTemplatePreviewChanged => EventBus.GetPubSubEvent<ReportTemplatePreviewChangedEventArgs>();
        /// <summary>
        /// 报告模板预览显示/隐藏请求
        /// </summary>
        public static void PublishReportTemplatePreviewChanged(bool isShow)
        {
            ReportTemplatePreviewChanged.Publish(new ReportTemplatePreviewChangedEventArgs(isShow));
        }
        #endregion

        #region ReportTemplatePreviewContentChanged
        public static PubSubEvent<ReportTemplatePreviewContentChangedEventArgs> ReportTemplatePreviewContentChanged => EventBus.GetPubSubEvent<ReportTemplatePreviewContentChangedEventArgs>();
        /// <summary>
        /// 报告模板预览内容已改变
        /// </summary>
        public static void PublishReportTemplatePreviewContentChanged()
        {
            ReportTemplatePreviewContentChanged.Publish(new ReportTemplatePreviewContentChangedEventArgs());
        }
        #endregion

        #endregion
    }
}